<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
	<head>
		<title>
		</title>
	</head>
	<body>
		<ui:composition template="/templates/masterLayout.xhtml">
			<ui:define name="windowTitle">
				<h:outputText value="#{msgs['emgmt.overview.title']}" />
			</ui:define>
			<ui:define name="content">
				<h:form id="employeeOverviewForm">
					<p:dataTable id="employeeTable" value="#{employeeBean.employees}" var="employee" editable="true">
						<f:facet name="header">
       						<h:outputText value="#{msgs['emgmt.overview.table.header']}" />
        				</f:facet>
        				<p:ajax event="rowEdit" listener="#{employeeBean.updateEmployee}" update=":employeeOverviewForm:employeeTable" /> 
						<p:column headerText="#{msgs['emgmt.overview.table.id']}">
							<h:outputText value="#{employee.id}" />			
						</p:column>
						<p:column headerText="#{msgs['emgmt.overview.table.name']}">
							<p:cellEditor>
								<f:facet name="output">
									<h:outputText value="#{employee.name}" />
								</f:facet>
								<f:facet name="input">
									<p:inputText value="#{employee.name}" />
								</f:facet>
							</p:cellEditor>
						</p:column>
						<p:column headerText="#{msgs['emgmt.overview.table.salary']}">
							<p:cellEditor>
								<f:facet name="output">
									<h:outputText value="#{employee.salary}" />	
								</f:facet>
								<f:facet name="input">
									<p:inputText value="#{employee.salary}" />
								</f:facet>
							</p:cellEditor>
						</p:column>
						<p:column>
							<p:rowEditor />
						</p:column>
					</p:dataTable>
					<p:button value="#{msgs['emgmt.overview.new']}" outcome="create" ajax="false" />
					<p:commandButton value="#{msgs['emgmt.overview.clear']}" action="#{employeeBean.deleteAllEmployees}" ajax="false" />
				</h:form>
			</ui:define>
		</ui:composition>
	</body>
</html>